<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>



  <head>
    <base href="<%=basePath%>">
    
    <title>instrument add</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="CSS/style.css">
<script type="text/javascript">
function check(form){
	if(form.barcode.value==""){
		alert("please enter barcode");form.barcode.focus();
		return false;
	}
	if(form.name.value==""){
		alert("please enter name");form.name.focus();
		return false;
	}
	if(!/^[A-Za-z0-9]+$/.test(form.name.value)){
		alert("instrument name is illegal");form.name.focus();
		return false;
	}
	if(!/^\d+$/.test(form.barcode.value))
	  {alert('barcode is illegal,number is ok');form.barcode.focus();
	  return false;}
	
	if(form.price.value!="" && !/^\d+(\.\d\d)?$/.test(form.price.value)){
		alert(" price with number is expected");form.price.focus();
		return false;
	}
	form.submit();
}

</script>
</head>
<body>

<table width="778"  border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td valign="top" bgcolor="#FFFFFF">
    <table width="99%" height="510"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="tableBorder_gray">
  <tr>
    <td height="510" valign="top" style="padding:5px;"><table width="98%" height="487"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="22" valign="top" class="current_addr">Current address：Instrument &gt;&gt; <font color="red">Add</font> </td>
      </tr>
      <tr>
        <td align="center" valign="top"><table width="100%" height="493"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="top">
	<form name="addForm" method="post" action="InstrumentAddServlet">
	<table width="700"   border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
     
     <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      </tr>
     
      <tr>
        <td width="173" align="center" class="attr">Barcode：</td>
        <td width="427" height="39">
          <input name="barcode" type="text" id="barcode" maxlength="45">
          <font color="red">&nbsp;&nbsp;*&nbsp;&nbsp;</font>  A string of digital. maxlength is 45 </td>
      </tr>
      <tr>
        <td align="center" class="attr">Name：</td>
        <td height="39">
        <input name="name" type="text"  maxlength="100">
          <font color="red">&nbsp;&nbsp;*&nbsp;&nbsp;</font> only charactors are expected</td>
      </tr>
  
      <tr>
        <td align="center" class="attr">Price：</td>
        <td height="39"><input name="price" type="text" id="price" maxlength="10"> 
          kr&nbsp;&nbsp;&nbsp;&nbsp;integer,decimal,rounded to two decimals.</td>
      </tr>
      
     <tr>
        <td align="center" class="attr">Remark：</td>
        <td><textarea name="remark" cols="50" rows="5"   id="remark" style="overflow-y:auto; resize: none;"></textarea></td>
      </tr>
      <tr>
        <td align="center">&nbsp;</td>
        <td height="39"><input name="submit1" type="button" class="btn" value="save" onClick="return check(addForm);">&nbsp;
		<input name="reset" type="reset" class="btn" value="reset">&nbsp;
		<input name="back" type="button" class="btn" value="back" onClick="history.back()">
		
		</td>
      </tr>
    </table>
	</form>
	</td>
  </tr>
</table></td>
      </tr>
    </table>
</td>
  </tr>
</table></td>
  </tr>
</table>

</body>
</html>
